<template>
	<view class="coupon_box">
		<coupon v-for="(item, index) in list" :key="index" v-bind:item="item" types="carts" theme="#ff6c00" color="#ffffff" solid="#ff6c00">
		</coupon>
	</view>
</template>

<script>
	import coupon from '@/component/coolc-coupon/coolc-coupon';
	import {
		findUserCoupon
	} from '@/api/user'
	export default {
		components: {
			coupon
		},
		data(){
			return {
				list: []
			}
		},
		onLoad() {
			
		},
		onShow() {
			findUserCoupon({openId:uni.getStorageSync('user').userId}, 'get')
			.then((res) => {
				console.log(res)
				if(res){
					var s = [];
					for(var index in res){
						s.push({url:'/pages/expressPages/expressPages',money:res[index].amount,end_time:res[index].endTime,state:res[index].useStatus})
					}
					this.list = s
					console.log(res);
				}
			})
		},
		methods:{

		}
	}
</script>

<style lang='scss'>
page { background:$bgcolor_white; }
.coupon_box {
	width:90%; height:auto; display:table; padding:6upx 26upx 26upx 26upx;
}

.other_type {
	width:100%; height:90upx; padding-top:50upx;
	
	.text { width:100%; border-top:1px solid #eeeeee; display:block; text-align:center; position:relative; }
	.text span { width:180upx; height:40upx; line-height:40upx; color:#999999; display:block; background:#ffffff; position:absolute; left:50%; top:50%; margin-left:-90upx; margin-top:-20upx; font-size:$font-base; }
}
</style>